<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>猫眼电影-娱乐看猫眼</title>
    <link rel="stylesheet" href="../css/main.css">
</head>
<body>
<div id="main">
    <div class="publicTop">
        <iframe  width="100%" height="100%" src="top.html" frameborder="0"></iframe>
    </div>

    <div class="content">
        <div class="content_left">
            <div class="title">
                <span style="font-size: 30px">正在热映(44部)</span>
                <span >全部</span>
            </div>
            <ul>
                <li v-for="item in movieList">
                    <div class="movieInfo">
                        <img class="movieImg" v-bind:src="'../img/movieImg/'+item.movieImgPath">
                        <div class="infor">
                            <div class="movieName">
                                {{item.movieName}}
                            </div>
                            <div class="score">
                                {{item.score}}
                            </div>
                        </div>
                    </div>
                    <div @click="goDetails(item.id)" class="ticketBut">
                        购票
                    </div>
                </li>

            </ul>
        </div>
        <div class="content_right">
            <div style="font-size: 30px;color: red; margin-bottom: 10px">今日票房</div>
            <ul>
                <li v-for="item in movieList.slice(0,5)">
                    <div class="left">
                        <span>{{item.id}}</span>
                        <span>{{item.movieName}}</span>
                    </div>

                    <span style="color: red">{{item.playScore}}万</span>
                </li>
            </ul>
        </div>

    </div>

</div>

<script type="text/javascript" src="js_view/vue.js"></script>
<script type="text/javascript" src="js_view/axios.main.js"></script>
<script type="text/javascript">
    var main = new Vue({
        el:"#main",
        data:{
            movieList:[]

        },

        methods:{
            getdataList:function(){
                axios.get("http://localhost:8081/getMovieList").then((result)=>{
                    console.log(result);
                    this.movieList = result.data;
                }).catch()
            },
            goDetails:function (id) {
                //跳转详情页
                location.href="details.html?id="+id;

            }
        },

        created(){
            this.getdataList();
        }
    })


</script>
</body>
</html>